package com.liutaw.nanjingair.views.activities.products;

import android.content.Context;
import android.content.Intent;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.liutaw.nanjingair.R;
import com.liutaw.nanjingair.views.activities.base.BaseActivity;
import com.liutaw.nanjingair.views.fragments.trending.FiveDayFragment;
import com.liutaw.navigationbarlib.NaviBarBuilder;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems;

import butterknife.Bind;
import butterknife.ButterKnife;

public class TrendForcastActivity extends BaseActivity {

    @Bind(R.id.viewpagertab)
    SmartTabLayout viewpagertab;
    @Bind(R.id.viewpager)
    ViewPager viewpager;

    public static Intent getCallingIntent(Context context) {
        return new Intent(context, TrendForcastActivity.class);
    }
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.layout_trend_forcast);
//    }

    @Override
    protected int getLayoutResId() {
        return R.layout.layout_trend_forcast;
    }

    @Override
    protected void initNaviBar(NaviBarBuilder naviBarBuilder) {
        naviBarBuilder.getWholeView().setBackgroundColor(getResources().getColor(R.color.title_bar_bg));
        naviBarBuilder.buildCenterView().buildTitleText("趋势预测", true);
    }

    @Override
    protected String getCusTitle() {
        return "趋势预测";
    }

    @Override
    protected void initOnCreate() {
        FragmentPagerItemAdapter fragmentPagerAdapter = new FragmentPagerItemAdapter(getSupportFragmentManager(), FragmentPagerItems.with(this).add("5天滚动天气预报", FiveDayFragment.class).add("一周趋势预报", FiveDayFragment.class).add("旬预报", FiveDayFragment.class).add("月预报", FiveDayFragment.class).create());
        viewpager.setAdapter(fragmentPagerAdapter);
        viewpagertab.setViewPager(viewpager);
    }

    @Override
    protected void initCusView(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }
}
